package com.ayz.gateway.core.session;


import com.ayz.gateway.core.context.config.Configuration;
import com.ayz.gateway.core.datasource.DatasourceFactory;
import com.ayz.gateway.core.rpc.IGatewayApi;
import com.ayz.gateway.core.session.http.HttpStatement;
import com.ayz.gateway.core.session.processor.RpcPostProcessor;

/**
 * @ClassName GatewaySession
 * @Description TODO:网关会话的接口定义
 * @Author 快乐的星球
 * @Date 2023/5/8 11:17
 * @Version 1.0
 **/

public interface GatewaySession {
    /**
     * 获取整个网关上下文的配置信息和RPC泛化代理对象的缓存
     * @return
     */
    public Configuration getConfiguration();

    /**
     * 获取数据源工厂类
     * @return
     */
    public DatasourceFactory getDatasourceFactory();

    /**
     * 根据RPC资源名称获取RPC资源
     * @param rpcResource
     * @return
     */
    public IGatewayApi getResource(String rpcResource);

    /**
     * 获取当前会话的HTTP请求参数封装类
     * @return
     */
    public HttpStatement getHttpStatement();
    /**
     * 开启一次会话,完成一次Http请求处理全过程
     * @throws Exception
     */
    public void open() throws Exception;

    /**
     * 获取Rpc增强器数组
     * @return
     */
    public RpcPostProcessor[] getRpcPostProcessors();

}
